{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "f97d90ab-e5a5-4c7d-a890-d7365b34e222",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "import datetime\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e19c9719-df1a-431d-bd6b-19b9c415649a",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.datetime(2017, 11, 24, 10, 30)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dt = datetime.datetime(year=2017, month=11, day=24, hour=10, minute=30)\n",
    "dt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "acd2cb0f-ea94-4041-9448-a6ffbdcd6bb9",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2017-11-24 10:30:00\n"
     ]
    }
   ],
   "source": [
    "print(dt)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "027d24fd-c745-4630-9ac5-f09f3224b8cd",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2017-11-24 00:00:00')"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts = pd.Timestamp(\"2017-11-24\")\n",
    "ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "f6a59d99-3753-48d5-8ac1-3b6e4364f9ad",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "11"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.month"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "6c946b81-2ff7-4764-9406-e9ecf00b3a81",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "24"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "49600487-b471-4506-ba41-63c3c931be37",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2017-11-29 00:00:00')"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts + pd.Timedelta(\"5 days\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "86f99363-3c6f-48f0-ad91-606a11ad0bd9",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    2017-11-24\n",
       "1    2017-11-25\n",
       "2    2017-11-26\n",
       "dtype: object"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s = pd.Series([\"2017-11-24\", \"2017-11-25\", \"2017-11-26\"])\n",
    "s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "6cf9c457-efa4-445e-9cb8-2dd630871597",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "ts = pd.to_datetime(s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "69f9f9bd-7530-4867-9515-765e566d4a84",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0   2017-11-24\n",
       "1   2017-11-25\n",
       "2   2017-11-26\n",
       "dtype: datetime64[ns]"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "e35f01d6-1b21-4fa1-9938-81b134fd3714",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    0\n",
       "1    0\n",
       "2    0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.dt.hour"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "56b96365-4cee-4e72-903f-3b36217cac81",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0   2017-11-24 11:11:11\n",
       "1   2017-11-24 23:11:11\n",
       "2   2017-11-25 11:11:11\n",
       "3   2017-11-25 23:11:11\n",
       "4   2017-11-26 11:11:11\n",
       "5   2017-11-26 23:11:11\n",
       "6   2017-11-27 11:11:11\n",
       "7   2017-11-27 23:11:11\n",
       "8   2017-11-28 11:11:11\n",
       "9   2017-11-28 23:11:11\n",
       "dtype: datetime64[ns]"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time = pd.Series(pd.date_range(start=\"2017-11-24 11:11:11\", periods = 10, freq = \"12H\"))\n",
    "time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d0ce7757-e2db-4201-a742-659575a4b049",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
